<template>
  <span v-text="dateStr"></span>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import XEUtils from 'xe-utils'

interface Props {
  date: Date
  format?: string
}
const props = defineProps<Props>()

const dateStr = computed(() => {
  if(!props.date) return '-'
  const date = new Date(props.date)
  return XEUtils.toDateString(date, props.format || 'yyyy-MM-dd HH:mm:ss')
})
</script>
